package com.kede.api.order.controller;

import com.kede.api.order.controller.po.SureExchangeSuppliePo;
import com.kede.api.order.service.IStoreService;
import com.kede.pojo.PagePO;
import com.kede.pojo.ResHttp;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 订单服务
 *
 * @author 11856
 * @date 2023/06/12
 */
@RequestMapping("order/store")
@RestController
public class StoreController {

    @Resource
    private IStoreService storeService;

    /**
     * 获取改门店下所有的线下订单（也就是物资订单）
     * @param page
     * @param storeId
     * @return
     */
    @GetMapping("getStoreSupplieOrder")
    public ResHttp getStoreSupplieOrder(PagePO page, Integer storeId){
        return storeService.getStoreSupplieOrder(page,storeId);
    }


    /**
     * 门店确认给用户兑换了物资
     * @param sureExchangeSuppliePo
     * @return
     */
    @PostMapping("SureExchangeSupplie")
    public ResHttp SureExchangeSupplie(@RequestBody SureExchangeSuppliePo sureExchangeSuppliePo){
        return storeService.SureExchangeSupplie(sureExchangeSuppliePo.getImgarrStr(),sureExchangeSuppliePo.getOrderId());
    }


    /**
     * 门店删除用户物资订单
     * @param orderId
     * @return
     */
    @GetMapping("delStoreSupplieOrder")
    public ResHttp delStoreSupplieOrder(Integer orderId){
        return storeService.delStoreSupplieOrder(orderId);
    }



}
